package com.waghost.bridalgown.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.waghost.bridalgown.dao.BannerDao;
import com.waghost.bridalgown.dao.CategoryDao;
import com.waghost.bridalgown.entity.Banner;
import com.waghost.bridalgown.entity.Category;
import com.waghost.bridalgown.entity.Result;
import com.waghost.bridalgown.service.BannerService;
import com.waghost.bridalgown.service.CategoryService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

@AllArgsConstructor
@Service
public class IBannerService implements BannerService {

    private BannerDao bannerDao;


    @Override
    public Result list() {
        return Result.success(bannerDao.selectList(null));
    }

    @Override
    public Result getId(Integer id) {
        return Result.success(bannerDao.selectById(id));
    }

    @Override
    public Result add(Banner banner) {
        return Result.toAjax(bannerDao.insert(banner), "添加成功", "添加错误");
    }

    @Override
    public Result update(Banner banner) {
        return Result.toAjax(bannerDao.updateById(banner), "修改成功", "修改错误");
    }

    @Override
    public Result delete(Integer id) {
        return Result.toAjax(bannerDao.deleteById(id), "删除成功", "删除错误");
    }

}
